/*
 * uc_led.c
 *
 *  Created on: Feb 8, 2013
 *      Author: bfakhri
 */
#include "uc_led.h"
#include "gpio.h"
//#include "gpio.c"

//Calls uc_led_off () four times to turn all LED's off.
void uc_led_all_off()
{
	for(int c=0; c<4; c++)
	{
		uc_led_off(c);		// Turns all of them off 
	}
}

//Calls uc_led_on() four times to turn all LED's on.
void uc_led_all_on()
{
	for(int c=0; c<4; c++)
	{
		uc_led_on(c);		// Turns all of them on 
	}	
}

//Calls uc_led_toggle() four times to toggle all LED's.
void uc_led_all_toggle()
{
	for(int c=0; c<4; c++)
	{
		uc_led_toggle(c);		// Toggles all of them 
	}
}


//Calls gpio_port_tc_init() to initialize the pin that each LED is connected to.
void uc_led_init()
{
	gpio_port_tc_init();	// Initializes all led pins
}

//Calls gpio_port_tc_set_pin_state() to set the state of the pin for LED p_led to turn the
//LED off.
void uc_led_off (int p_led)
{
	gpio_port_tc_set_pin_state(p_led, 0);	// Turns p_led off
}
//Calls gpio_port_tc_set_pin_state() to set the state of the pin for LED p_led to turn the
//LED on.
void uc_led_on(int p_led)
{
	gpio_port_tc_set_pin_state(p_led, 1); 	// Turns p_led on 
}

//Calls gpio_port_tc_get_pin_state() to determine if LED p_led is on or off. It it is on, turn
//it off or if it is off, turn it on.
void uc_led_toggle(int p_led)
{
	gpio_port_tc_set_pin_state(p_led, !gpio_port_tc_get_pin_state(p_led)); 
}
